<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">列表</a>
            <a>
              <cite>管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="float: right;height: 30px;line-height: 30px;margin-top: 5px;" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form action="#" class="layui-form layui-col-space5" th:action="@{/admin/scoreInfo}" method="post">
                        <div class="layui-inline ">
<!--                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.examId}" name="examId" placeholder="搜索考试编号" id="examId" />-->
                            <select name="examId" id="examId" lay-search lay-filter="examId" th:field="${searchInfo.examId}">
                                <option value="">搜索考试编号</option>
                                <option th:each="exam:${examList}"
                                        th:text="${exam.examName}" th:value="${exam.id}"></option>
                            </select>
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.grade}" name="grade" placeholder="搜索班级" id="grade" />
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.name}" name="name" placeholder="搜索学生姓名" id="name" />
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.room}" name="room" placeholder="搜索考场编号" id="room" />
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.chinese}" name="chinese" placeholder="搜索语文成绩" id="chinese" />
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.math}" name="math" placeholder="搜索数学成绩" id="math" />
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.english}" name="english" placeholder="搜索英语成绩" id="english" />
                        </div>
                        <div class="layui-inline ">
                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.wenSum}" name="wenSum" placeholder="搜索文科综合" id="wenSum" />
                        </div>
                        <div class="layui-inline ">
                        <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.liSum}" name="liSum" placeholder="搜索理科综合" id="liSum" />
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn  layui-btn-success radius"><i class="layui-icon">&#xe615;</i>
                            </button>
                        </div>
                        <div class="cl pd-5 bg-1 bk-gray " >
							<span class="l">
                                <a href="javascript:;"
                                   onclick="deleteAll('/admin/scoreInfo/deleteAll')"
                                   class="layui-btn  layui-btn-danger radius"><i class="layui-icon">&#xe64d;</i> 批量删除</a>
                                <a href="javascript:;"
                                   onclick="layer_show('添加','/admin/scoreInfo/addBefore',900,500)"
                                   class="layui-btn  layui-btn-normal radius"><i class="layui-icon">&#xe600;</i> 添加</a>

                                <a class="layui-btn  layui-btn-normal radius">
                                    <label for="fileupload" style="cursor:pointer;" title="点击导入">
                                        <div id="drag" title="将文件拖拽到此处上传">
                                            <i class="layui-icon">&#xe600;</i>表格导入
                                        </div>
                                    </label>
                                    <input data-url="/admin/scoreInfo/uploadExcel" id="fileupload" multiple="multiple"
                                           name="fileupload"
                                           style="display: none" type="file">
                                </a>

                            </span>
                            <span class="r wei-height" style="float: right;margin-right: 20px">共有数据：<strong
                                        th:text="${pageInfo.total}"></strong> 条</span>
                        </div>
                        <div class="layui-card-body" style="text-align: center">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr class="text-c">
                                    <th width="25"><input type="checkbox" name="" value="" lay-filter="checkall" lay-skin="primary"/></th>
                                    <th width="25">序号</th>
                                        <th width="40">班级</th>
                                        <th width="50">学生姓名</th>
                                        <th width="50">语文成绩</th>
                                        <th width="50">数学成绩</th>
                                        <th width="50">英语成绩</th>
                                        <th width="50">文科综合</th>
                                        <th width="50">理科综合</th>
                                        <th width="50">总分</th>
                                        <th width="50">班名次</th>
                                        <th width="50">校名次</th>
                                    <th width="100">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="text-c" th:if="${pageInfo.list.size() == 0}">
                                    <td colspan="15"><strong>暂无数据</strong></td>
                                </tr>
                                <tr class="text-c" th:each="scoreInfo,count:${pageInfo.list}">
                                    <td><input type="checkbox" value="1" th:value="${scoreInfo.id}"
                                               name="id" lay-skin="primary"/></td>
                                    <td th:text="${count.count}"></td>
                                                <td th:text="${scoreInfo.grade}"></td>
                                                <td th:text="${scoreInfo.name}"></td>
                                                <td th:text="${scoreInfo.chinese}"></td>
                                                <td th:text="${scoreInfo.math}"></td>
                                                <td th:text="${scoreInfo.english}"></td>
                                                <td th:text="${scoreInfo.wenSum}"></td>
                                                <td th:text="${scoreInfo.liSum}"></td>
                                                <td th:text="${scoreInfo.scoreSum}"></td>
                                                <td th:text="${scoreInfo.gradeRank}"></td>
                                                <td th:text="${scoreInfo.schoolRank}"></td>
                                    <td class="td-manage">
                                        <a title="编辑" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'编辑\',\'/admin/'+'scoreInfo'+'/editBefore/'+${scoreInfo.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe642;</i></a>
                                        <a title="删除" href="javascript:;"
                                           th:onclick="'javascript:deleteById(\'/admin/'+'scoreInfo'+'/delete/'+${scoreInfo.id}+'\')'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe640;</i></a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:include="_pagination :: page"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>
<!--/_footer 作为公共模版分离出去-->

<!-- 文件上传组件 -->
<script th:src="@{/xadmin/lib/jQuery-File-Upload/js/vendor/jquery.ui.widget.js}"></script>
<script th:src="@{/xadmin/lib/jQuery-File-Upload/js/jquery.iframe-transport.js}"></script>
<script th:src="@{/xadmin/lib/jQuery-File-Upload/js/jquery.fileupload.js}"></script>


<script>

    $(function () {
        $('#fileupload').fileupload({
            // dataType: 'json',
            dropZone: $('#drag'),
            change: function (e, data) {
            },
            start: function (e) {
                layer_msg = layer.msg('正在上传中…', {time: 100000000});
            },
            progressall: function (e, data) {
                $('.layui-layer-msg .layui-layer-content').html('已上传' + (data.loaded / data.total * 100).toFixed(2) + '%');
            },
            done: function (e, data) {
                if (data._response.result.code == 1) {
                    layer.close(layer_msg);
                    // selfmsg(data._response.result.msg,1,function (){
                    //     location.reload();
                    // })
                    layer.confirm(data._response.result.msg, function () {
                        location.reload();
                    });

                } else {
                    selfmsg("导入失败", function () {
                        location.reload();
                    })
                }
            }
        });

        $('#drag').bind('drop dragover', function (e) {
            e.preventDefault();
        }).on('dragenter', function (e) {
            $(this).addClass('dragenter');
        }).on('drop', function (e) {
            $(this).removeClass('dragenter');
        }).on('dragleave', function (e) {
            $(this).removeClass('dragenter');
        });

    });

    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({

        });
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });


</script>
</body>
</html>